<template>
  <div>
    <eagle-dialog
      title="选择点检周期"
      @confirm="confirm"
      @open="onOpen"
      ref="eagleDialog"
      v-bind="$attrs"
      v-on="$listeners"
    >
      <div class="dialog-content-radio">
        <eagle-radio-group
          v-model="CheckFrequency"
          direction="horizontal"
        >
          <div
            v-for="(item, index) in data.CheckFrequencyList"
            :key="index"
            style="margin-bottom: 10px"
            :style="{ width: item.ID ? '50%' : '100%' }"
          >
            <eagle-radio v-if="item.ID" :name="item.ID">
              <span style="font-size: 14px">{{ item.Name }}</span>
            </eagle-radio>
            <div v-else>
              <eagle-radio :name="item.ID">
                <span style="font-size: 14px">{{ item.Name }}</span>
              </eagle-radio>
              <eagle-input label="" v-model="CheckFrequencyName"></eagle-input>
            </div>
          </div>
        </eagle-radio-group>
      </div>
    </eagle-dialog>
  </div>
</template>
<script>
import eagleRadio from "../../../components/eagle/eagle-radio.vue";
export default {
  components: { eagleRadio },
  name: "check-frequency-dialog",
  props: {
    data: {},
  },
  data() {
    return {
      CheckFrequency: "",
      CheckFrequencyName: "",
    };
  },
  methods: {
    confirm() {
      let result = "";
      result = this.CheckFrequency;
      this.$emit("close", result);
    },
    onOpen() {
      if (this.data.CheckFrequency) {
        this.CheckFrequency = this.data.CheckFrequency;
        this.CheckFrequencyName = "";
      }
    },
  },
};
</script>
<style lang="less" scoped>
.dialog-content-radio {
  padding: 0 15px;
}
</style>
